﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing.Printing;
using System.Drawing;
using System.Windows.Forms;

namespace ImageProcessing
{
   public class Printing
    {
        public static PrintDocument printDoc;
        public static Image photo;
        public Printing(Bitmap bmp)
        {
            photo = bmp;
            printDoc = new PrintDocument();
            printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
            printDoc.Print();
        }
            public static void printDoc_PrintPage(object sender, PrintPageEventArgs e)
            {
                Point ulCorner = new Point(100, 100);
                e.Graphics.DrawImage(photo, ulCorner);
            }
        public static void PrintPreview()
        {
            PrintPreviewDialog dlg = new PrintPreviewDialog();
            dlg.Document = printDoc;
            dlg.ShowDialog();
        }

        public static void PrinterSettingsDialog()
        {
            PrintDialog dlg = new PrintDialog();
            dlg.Document = printDoc;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                printDoc.Print();
            }
        }

        
    }
}
